package com.cy.controller;


import com.cy.entity.Order;
import com.cy.service.IOrderService;
import com.cy.util.JsonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;


/**
 * 时间：2023/1/8
 */
@RestController
@RequestMapping("/orders")
public class OrderController extends BaseController {

    @Resource
    private IOrderService orderService;

    @RequestMapping("/create")
    public JsonResult<Order> create(Integer aid, Integer[] cids, HttpSession httpSession){
        Integer uid = getuidFromSession(httpSession);
        String username = getUsernameFromSession(httpSession);
        Order data = orderService.create(aid,cids,uid,username);
        return new JsonResult<>(OK,data);
    }
}
